package ReSofting.it.GoldDirector.Model;

import java.util.*;

import ReSofting.it.GoldDirector.Adapters.ItemOrdineAdapter;
import ReSofting.it.GoldDirector.Adapters.MenuAdapter;
import android.text.format.DateFormat;
import android.util.Log;

public class myOrdine 
{
	public int IDOrd ;
	public String Tavolo ;
	public String Note ;
	public int NItems ;	
	public int NClienti ;	
	public int NCoperti ;
	public Boolean Evaso ;
	public float Totale ;
	public int FkCreator ;
	
	public  ArrayList<myItemOrdine> MenuItems ; 
	
	private ItemOrdineAdapter _adapter ;
	
	 public myOrdine()
	 {
		 
	 }
	
	 public myOrdine(String pTavolo, int pNClienti, int pNCoperti, ItemOrdineAdapter pAdapter) 
	 {
		 		 	 
		 this.Tavolo = pTavolo;
		 this.NClienti = pNClienti;
		 this.NCoperti = pNCoperti;
		 
		 MenuItems = new ArrayList<myItemOrdine>();
			 
		 _adapter = pAdapter;	        
	 }
	 
	 
	 
	 public void addOrderItem(myMenu pItem , int pTot, String pNote )
	 {		 
		 MenuItems.add(new myItemOrdine(0, pItem.Nome,pItem.GuidIDMn,  pTot,pNote)  );		 
		 _adapter.notifyDataSetChanged();		
		 
		 Log.d("Diego new item in order", pItem.Nome  );
			 
	 }//fM
	 
	 
	 public void addOrderItem(UUID pGuidMn,String pName, int pTot, String pNote )
	 {		 
		 MenuItems.add(new myItemOrdine(0,pName,pGuidMn,  pTot, pNote ) );		 
		 _adapter.notifyDataSetChanged();
		 
	 }//fM
	 
	 
	 public void setAdapter(ItemOrdineAdapter pAdapter)
	 {
		 _adapter = pAdapter;		 
	 }
	 
	 
	 public  myItemOrdine findInOrderItems_byID (UUID pFkMenu)//lascia UUID
		{
			if(MenuItems == null) return null;
			
			 for (int i = 0; i < MenuItems.size(); ++i) 
		        {	        					
		        	if (  MenuItems.get(i).FkMenu == pFkMenu )  
		        		return MenuItems.get(i);			
		        }   
			 
			 return null;
			
		}//fM
	 
	
	 

}
